﻿// //------------------------------------------------------------------------------
// // <copyright file="" company="Dascoba Development">
// //  Copyright © Dascoba Development 2010
// // </copyright>
// //------------------------------------------------------------------------------
using System;

namespace Dascoba.Umb.FileManager.Dialogs
{
    using System.IO;

    using Dascoba.Umb.FileManager.Config;
    using Dascoba.Umb.FileManager.Support;

    /// <summary>
    ///   Upload File
    /// </summary>
    public partial class UploadFiles : umbraco.BasePages.UmbracoEnsuredPage
    {
        /// <summary>
        ///   Handles the Load event of the Page control.
        /// </summary>
        /// <param name = "sender">The source of the event.</param>
        /// <param name = "e">The <see cref = "System.EventArgs" /> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            var folder = this.Request["folder"] == "root"
                             ? "User Root"
                             : new DirectoryInfo(Util.MapUrl(this.Request["folder"])).Name;

            this.pane_upload.Text = umbraco.ui.Text("fileman", "uploadTo", folder, CurrentUser);

            this.pnlFileQueue.GroupingText = umbraco.ui.Text("fileman", "uploadQueue");
        }

        /// <summary>
        ///   Gets the folder URL.
        /// </summary>
        /// <value>The folder URL.</value>
        protected string FolderUrl
        {
            get
            {
                return this.Request["folder"] == "root" ? FileManagerConfig.CurrentUserRootUrl : this.Request["folder"];
            }
        }
    }
}